package PTA_05_24;

import LIST.Arraylist;

import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

class Person
{
    private String name;
    private int age;

    public Person(String name, int age) {
        this.name = name;
        this.age = age;
    }

    public Person() {
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    @Override
    public String toString() {
        return "Person [" +
                "name=" + name +
                ", age=" + age +
                ']';
    }
}

public class Main3 {
    public static void main(String[] args) {
        List<Person> arraylist = new ArrayList<>();
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        for(int i = 0; i < n; i++)
        {
            Person person = new Person(sc.next(),sc.nextInt());
            arraylist.add(person);
        }
        for (int i = 0; i < n; i++) {
            System.out.println(arraylist.get(i));
        }
        //进行判断
        String com = sc.next();
        for (int i = 0; i < n; i++) {
            if(com.equals(arraylist.get(i).getName()))
            {
                System.out.println(arraylist.get(i));
                return;
            }
        }
        System.out.println("此人不存在");
    }
}
